/* eslint valid-jsdoc: "off" */

"use strict";

const userConfig = require("./config.user");
/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = (appInfo) => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = (exports = {});

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + "_1642570255081_432";

  // add your middleware config here
  config.middleware = ["errorHandler", "auth"];

  config.security = {
    csrf: {
      enable: false,
    },
  };

  config.mongoose = {
    url: "mongodb://127.0.0.1/2022-blog",
    options: {},
  };

  config.jwt = {
    secret: userConfig.userName,
  };

  config.auth = {
    whiteList: [userConfig.userName],
  };

  return {
    ...config,
    ...userConfig,
  };
};
